import request from '@/utils/request'
// 获取所有频道列表
export const getChannels = params => request.get('/channels', { params })
// 登录
export const getAuthorizations = params => request.post('/authorizations', params)
// 获取用户频道
export const getUserChannels = params => request.get('/user/channels', { params })
// 获取文章新闻推荐
export const getArticles = params => request.get('/articles', { params })
// 不感兴趣
export const getArticlesDislikes = params => request.post('/article/dislikes', params)
// 举报
export const getArticlesReports = params => request.post('/article/reports', params)
// 更新用户频道
export const updateUserChannels = ( channels ) => request({
  url: '/user/channels',
  method: 'PUT',
  data: {
    channels
  }
})
// 获取新闻详情
export const getArticleDetail = params => request.get('/articles/' + params)
// 文章-关注作者
export const followedUserAPI = params => request.post('/user/followings', params)
// 文章-取消关注作者
export const unFollowedUserAPI = ( uid ) => request({
  url: '/user/followings/' + uid,
  method: 'DELETE'
})
// 文章 - 点赞
export const articleLikeAPI = params => request.post('/article/likings', params)
// 文章 - 取消点赞
export const articleDisLikeAPI = ( aid ) => request({
  url: '/article/likings/' + aid,
  method: 'DELETE'
})
// 获取评论数据
export const getCommentsAPI = params => request.get('/comments', { params })
// 对文章进行评论
export const sendCommentAPI = params => request.post('/comments', params)
// 收藏文章
export const articleCollectionsAPI = params => request.post('/article/collections', params)
//取消收藏文章
export const commentCollectionsAPI = ( aId ) => request({
  url: '/article/collections/' + aId,
  method: 'DELETE'
})
// 获取用户收藏列表
export const getArticleCollectionsAPI = params => request.get('/article/collections', { params })


// 评论点赞
export const commentLikingAPI = params => request.post('/comment/likings', params)
// 评论取消点赞
export const commentDisLikingAPI = ( comId ) => request({
  url: '/comment/likings/' + comId,
  method: 'DELETE'
})
// 获取联想建议（自动补全）
export const getSuggestion = params => request.get('/suggestion', { params })
// 获取搜索结果
export const getSearch = params => request.get('/search', { params })
// 获取用户自己信息
export const getUser = params => request.get('/user', { params })
// 获取用户个人资料
export const getUserProfile = params => request.get('/user/profile', { params })
// 编辑用户头像资料
export const updatePhotoAPI = ( data ) => request({
  url: '/user/photo',
  method: 'PATCH',
  data
})
// 编辑用户个人资料
export const updateProfileAPI = ( data ) => request({
  url: '/user/profile',
  method: 'PATCH',
  data
})



